// 类的只读属性
export {}

class Person {
    name: string
    private age: number
    protected readonly gender: boolean
    constructor(name: string, age: number) {
        this.name = name
        this.age = age
        this.gender = true
    }

    sayHi(msg: string): void {
        console.log(`I am ${this.name}`)
        console.log(this.age)
        // this.gender = false // 报错 不可修改只读属性
    }
}

const tom = new Person("tom", 19)
console.log(tom.name)
